<%-------------------------------------------------------------------
 * 页面名称：main.jsp
 * 功能描述：登录页面
 * Action:  logon.do
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="struts-html.tld" prefix="html"%>
<%@ taglib uri="struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="struts-logic.tld" prefix="logic"%>
<%@ taglib uri="struts-bean.tld" prefix="bean"%>

<%
	String path = request.getContextPath();
	String email = (String) request.getSession().getAttribute("email");
	if (email == null) {
		email = "";
	} else {
		request.getSession().removeAttribute("email");
	}
	String operator = (String) request.getSession().getAttribute(
			"operator");
	if (operator == null) {
		operator = "";
	} else {
		request.getSession().removeAttribute("operator");
	}
	boolean net = request.getSession()
			.getAttribute("netReturnResponse") == null;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type"
			content="text/html; charset=charset=utf-8">
		<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/font.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/newstyle.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/common.css" rel="stylesheet" type="text/css" />
		<script type='text/javascript' src='<%=path%>/dwr/engine.js'></script>
		<script type="text/javascript"
			src="<%=path%>/js/vnv/commonForMutual.js"></script>
		<script type="text/javascript" src="<%=path%>/js/pagetitle.js"></script>
		<style type="text/css">
<!--
.box {width:448px;margin:auto;border-top:none;}
.off {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#003365;font-size:14px;font-weight:bold;text-align:center;cursor:pointer;}
.on {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#B77443;font-size:14px;font-weight:bold;text-align:center;}
.tab {width:450px;margin:auto;float:left;border: solid;}
-->
</style>
		<SCRIPT LANGUAGE="JavaScript">
<!--
	// 切换tab显示
	function switchTab(id_num,num){
		for(var i=1;i<=2;i++) { 
			if(id_num==i) { 
				getObj('Tab_'+i).className='on'; 
				getObj('cont_'+i).style.display='';
			} 
			else { 
				getObj('Tab_'+i).className='off'; 
				getObj('cont_'+i).style.display='none'; 
			} 
		}
		// 刷新校验码
		refreshVericode('logon_sys_vericode_image'+num);
		getObj('logon_person_email').value='';
		getObj('logon_person_passPerson').value='';
		getObj('logon_person_sys_vericode').value='';
		getObj('logon_corp_email').value='';
		getObj('logon_corp_operator').value='';
		getObj('logon_corp_passCorp').value='';
		getObj('logon_corp_sys_vericode').value='';

		// 获得焦点
		if(num == 0) {
			getObj('logon_person_email').focus();
		}
		if(num == 1) {
			getObj('logon_corp_email').focus();
		}
	}
	// 刷新校验码
	function refreshVericode(imgObjName) {
		var now = new Date();
		getObj(imgObjName).src = '<%=path%>/page/util/verifyImage.jsp?now='+now.getTime().toString();
	}

	function logon(type) {
		document.getElementById("logon_atype").value = type;
		
		if(type == "A") { //个人
			if(emptyValidate(getObj("logon_person_email"),"Email或手机") != "") {
				getObj("logon_person_email").focus();
				return false;
			}		
			if(emptyValidate(getObj("logon_person_passPerson"),"登录密码") != "") {
				getObj("logon_person_passPerson").focus();
				return false;
			}
			if(emptyValidate(getObj("logon_person_sys_vericode"),"校验码") != "") {
				getObj("logon_person_sys_vericode").focus();
				return false;
			}				
		} else if(type == "B") { //企业
			
			if(emptyValidate(getObj("logon_corp_email"),"Email") != "") {
				getObj("logon_corp_email").focus();
				return false;
			}		
			if(emptyValidate(getObj("logon_corp_operator"),"操作员") != "") {
				getObj("logon_corp_operator").focus();
				return false;
			}
			if(emptyValidate(getObj("logon_corp_passCorp"),"登录密码") != "") {
				getObj("logon_corp_passCorp").focus();
				return false;
			}	
			if(emptyValidate(getObj("logon_corp_sys_vericode"),"校验码") != "") {
				getObj("logon_corp_sys_vericode").focus();
				return false;
			}		
		}
				
		document.getElementById("url").value=location.href;
		
		document.frmLogon.submit();
	}
	
	function pers() {
		if(event.keyCode==13){
			logon('A');
		}
	}
	function corp() {
		if(event.keyCode==13){
			logon('B');
		}
	}
//-->
</SCRIPT>
	</head>

	<%
	if (net) {
	%>
	<body>
		<%
		} else {
		%>
	
	<body onload="switchTab('2',1);">
		<%
		}
		%>
		<table width="100%" height="100%" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td align="center" valign="middle">
					<br />
					<br />
					<br />
					<br />
					<br />
					<table width="450" height="300" border="0" cellpadding="10"
						cellspacing="0">
						<tr>
							<td>
								<table width="100%" height="45" border="0" cellpadding="0"
									cellspacing="0">
									<tr>
										<logic:present name="logon_person_email" scope="request">
											<td align="center" />
												欢迎登录!
										</logic:present>
									</tr>
								</table>
								<div class="tab">
									<div class="on" id="Tab_1" onclick="switchTab('1',0);">
										个人登录
									</div>
									<div class="off" id="Tab_2" onclick="switchTab('2',1);">
										企业登录
									</div>
								</div>
								<div style="clear:both;"></div>
								<form name="frmLogon" action="<%=path%>/logon.do" method="post">
									<input type="hidden" id="logon_atype" name="logon_atype" />
									<!-- 个人用户登录区域开始 -->
									<div class="box" id="cont_1" onKeyDown="pers()">
										<table width="100%" border="0" align="center" cellpadding="5"
											cellspacing="1">
											<tr>
												<td height="25" colspan="2" align="right">
													&nbsp;
												</td>
											</tr>
											<tr>
												<td height="25" align="right">
													Email或手机：
												</td>
												<td align="left">
													<input name="logon_person_email" type="text"
														class="login_inputsytle" maxlength="100" />
													<input type="hidden" id="from" name="from"
														value="invalid_session_failure" />
													<input type="hidden" id="url" name="url" />
												</td>
											</tr>
											<tr>
												<td width="24%" height="25" align="right">
													登 录 密 码：
												</td>
												<td width="76%" align="left">
													<input name="logon_person_passPerson" type="password"
														class="login_inputsytle" maxlength="64" />
												</td>
											</tr>
											<tr>
												<td height="25" align="right">
													校 验 码：
												</td>
												<td align="left">
													<input name="logon_person_sys_vericode" maxlength="4"
														type="text" size="4" onblur="killSpace(this);" utext="校验码"
														uregular="UValidate.notEmpty" />
													<img name="logon_sys_vericode_image0"
														src="<%=path%>/page/util/verifyImage.jsp" width="60"
														height="24" align="absmiddle" />
													&nbsp;
													<img class="arrowPosi"
														src="<%=path%>/page/information/images/reset.gif"
														width="13" height="12" align="absmiddle"
														style="cursor:hand;" title="看不清校验码请点击此图标刷新！"
														onclick="javascript:refreshVericode('logon_sys_vericode_image0');" />
												</td>
											</tr>
											<tr>
												<td height="25" align="right">
													&nbsp;
												</td>
												<td align="left">
													<input name="login" type="button" class="graybutton_style"
														value="登 录" onclick="logon('A')" />
													&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													<input name="toRegister" type="button"
														class="graybutton_style" value="注 册"
														onclick="location='<%=path%>/toRegister.do'" />
												</td>
											</tr>
											<tr>
												<td height="25" colspan="2" align="center">
													<a href="<%=path%>/toActimail.do" >重发激活信</a>
													<a href="<%=path%>/toActivate.do" >填写激活码</a>
													<a href="<%=path%>/toForgot.do" >忘记密码了</a>
													<a href="<%=path%>/main.do">返回首页</a>
												</td>
											</tr>
										</table>
									</div>
									<!-- 个人用户登录区域结束 -->
									<!-- 企业用户登录区域开始 -->
									<div class="box" id="cont_2" style="display:none;"
										onKeyDown="corp()">
										<table width="100%" border="0" align="center" cellpadding="5"
											cellspacing="1">
											<tr>
												<td height="25" colspan="2" align="right">
													&nbsp;
												</td>
											</tr>
											<tr>
												<td height="25" align="right">
													Email：
												</td>
												<td align="left">
													<input name="logon_corp_email" type="text"
														class="login_inputsytle" maxlength="100" />
													<input type="hidden" id="from" name="from"
														value="company_main_failure" />
													<input type="hidden" id="url" name="url" />
												</td>
											</tr>
											<tr>
												<td height="25" align="right">
													操 作 员：
												</td>
												<td align="left">
													<input name="logon_corp_operator" type="text"
														class="login_inputsytle" maxlength="64" />
												</td>
											</tr>
											<tr>
												<td width="24%" height="25" align="right">
													登 录 密 码：
												</td>
												<td width="76%" align="left">
													<input name="logon_corp_passCorp" type="password"
														class="login_inputsytle" />
												</td>
											</tr>
											<tr>
												<td height="25" align="right">
													校 验 码：
												</td>
												<td align="left">
													<input name="logon_corp_sys_vericode" maxlength="4"
														type="text" size="4" onblur="killSpace(this);" utext="校验码"
														uregular="UValidate.notEmpty" />
													<img name="logon_sys_vericode_image1"
														src="<%=path%>/page/util/verifyImage.jsp" width="60"
														height="24" align="absmiddle" />
													&nbsp;
													<img class="arrowPosi"
														src="<%=path%>/page/information/images/reset.gif"
														width="13" height="12" align="absmiddle"
														style="cursor:hand;" title="看不清校验码请点击此图标刷新！"
														onclick="javascript:refreshVericode('logon_sys_vericode_image1');" />
												</td>
											</tr>
											<tr>
												<td height="25" align="right">
													&nbsp;
												</td>
												<td align="left">
													<input name="login" type="button" class="graybutton_style"
														value="登 录" onclick="logon('B')" />
													&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													<input name="login" type="button" class="graybutton_style"
														onclick="location='<%=path%>/toCompanyRegister.do'"
														value="注 册" />
												</td>
											</tr>
											<tr>
												<td height="25" colspan="2" align="center">
													<a href="<%=path%>/toActimail.do">重发激活信</a>
													<a href="<%=path%>/toActivate.do">填写激活码</a>
													<a href="<%=path%>/toForgot.do">忘记密码了</a>
													<a href="<%=path%>/main.do">返回首页</a>
												</td>
											</tr>
										</table>
									</div>
									<!-- 企业用户登录区域结束 -->
								</form>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<%
			// 返回错误提示时保留输入的账号内容
			if (!operator.equals("")) {
		%>
		<script language="javascript">
		switchTab('2',1)
		getObj('logon_corp_email').value='<%=email%>';
		getObj('logon_corp_operator').value='<%=operator%>';
		getObj("logon_corp_email").focus();
	</script>
		<%
		} else if (!email.equals("")) {
		%>
		<script language="javascript">
		getObj('logon_person_email').value='<%=email%>';
		getObj("logon_person_email").focus();
	</script>
		<%
		}
		%>
		<jsp:include page="/page/common/bankFramePage/message.jsp" />
	</body>
</html>
